<?php

namespace Qm;

class Query {

    public $sName;
    public $aLine       = array();
    public $sAccess     = 'public';
    public $aArgument   = array();

    public function __construct( $sName, $sAccess = 'public', array $aArgument = array() ) {

        if( ! is_string( $sName ) || empty( $sName ) ) {
            die( 'ivalid name' );
        } #if

        if( $sAccess != 'public' && $sAccess != 'private' && $sAccess != 'protected' ) {
            die( 'invalid access' );
        } #if

        $this->sName        = $sName;
        $this->sAccess      = $sAccess;
        $this->aArgument    = $aArgument;
    } #function __construct(

    /**
     * Push & colase new line into query.
     * @param string $sCode line content
     * @param integer $iLine  line number
     */
    public function pushLine( $sCode, $iLine ) {

        if( ! is_int( $iLine ) ) {
            die( 'invalid arg' );
        } #if

        if( ! is_string( $sCode ) ) {
            die( 'invalid arg' );
        } #if

        if( isset( $this->aLine[$iLine] ) ) {
            $this->aLine[$iLine] .= $sCode;
        } else {
            $this->aLine[$iLine] = $sCode;
        } #if
    } #function pushLine
} #class Query